<style>
.editbox
{
display:none
}
td
{
padding:5px;
}
.editbox
{
font-size:14px;
width:70px;
background-color:#ffffcc;
border:solid 1px #000;
padding:4px;
}
.edit_tr:hover
{
cursor:pointer;
}
</style>


<script type="text/javascript">
$(document).ready(function()
{
	$(".edit_tr").click(function()
	{
	var ID=$(this).attr('id');
		$("#stok_"+ID).hide();
		$("#stok_input_"+ID).show();
	}).change(function()
	{
	var ID=$(this).attr('id');
	var first=$("#stok_input_"+ID).val();
	var dataString = 'kode_data='+ ID +'|'+first;
	$("#stok_"+ID).html('<img src="<?php echo base_url(); ?>asset/images/load.gif" />');
		if(first.length>0)
		{
			$.ajax({
				type: "GET",
				url: "<?php echo base_url(); ?>laporan/returpembelian",
				data: dataString,
				cache: false,
				success: function(html)
				{
					$("#stok_"+ID).html(first);
				}
			});
		}
		else
		{
			alert('Inputan masih kosong');
		}
	});
	
	$(".editbox").mouseup(function() 
	{
		return false
	});
	
	$(document).mouseup(function()
	{
		$(".editbox").hide();
		$(".text").show();
	});

});
</script>
<div id="container">

	<h1><?php //echo $nama_perusahaan; ?></h1>
	<h2><?php //echo $alamat_perusahaan; ?></h2>

	<div id="body">
		<?php
			//echo $bio;
			//echo $menu;
		?>
		<div class="cleaner_h10"></div>
		<table align="center">
			<tr align="center">
				<td>
					<?php
						//echo $paginator;
					?>
				</td>
			</tr>
		</table>
		<div class="cleaner_h10"></div>
        <form method="post" name="frmSearch" action="<?php echo site_url('lapreturpembeliancontroller');?>">
		<table width="100%" cellpadding="3" cellspacing="0" border="1">
			<tr>
            	<td width="75">Tanggal</td>
                <td width="11">:</td>
                <td width="188"><input type="text"  name="tglawal" id="tglawal" maxlength="10" value="<? if($_POST['tglawal'] !=""){echo $_POST['tglawal'];} ?>" />
          <img src="jscalendar/img.gif" height="20" width="20"  id="trigger1"
     		style="cursor: pointer; border: 1px solid purple;"
     		title="Date selector"
     		onmouseover="this.style.background='purple';"
     		onmouseout="this.style.background=''" />
          <script type="text/javascript">
  			Calendar.setup(
				{
				  inputField  : "tglawal",         // ID of the input field
				  ifFormat    : "%Y-%m-%d",    // the date format
				  button      : "trigger1"       // ID of the button
			  //daFormat  :  "%Y/%m/%d" 
				}
		  	);
			</script></td>
                <td width="32">S/D </td>
                <td width="662"><input type="text"  name="tglakhir" id="tglakhir" maxlength="10" value="<? if($_POST['tglakhir'] !=""){echo $_POST['tglakhir'];} ?>" />
          <img src="jscalendar/img.gif" height="20" width="20" id="trigger2"
     		style="cursor: pointer; border: 1px solid purple;"
     		title="Date selector"
     		onmouseover="this.style.background='purple';"
     		onmouseout="this.style.background=''" />
          <script type="text/javascript">
  			Calendar.setup(
				{
				  inputField  : "tglakhir",         // ID of the input field
				  ifFormat    : "%Y-%m-%d",    // the date format
				  button      : "trigger2"       // ID of the button
			  //daFormat  :  "%Y/%m/%d" 
				}
		  	);
			</script>      </td>
			</tr>
            <tr>
            	<td width="75">Pilih Type</td>
                <td width="11">:</td>
                <td colspan="3">
                	<select name="pilihtype" id="select">
                        <option value="0">-Pilih-</option>
                        <option value="1">No Faktur</option>
                        <option value="2">No Retur</option>
                        <option value="3">Kode Barang</option>
           	  </select></td>
            </tr>
			<tr valign="top">
            	<td></td>
                <td colspan="5"><input type="submit" class="btn-kirim-login" value="Search"></td>
			</tr>
		</table>
        </form>
      <div class="cleaner_h10"></div>
		<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
			<tr style="background-color:#000000; color:#FFFFFF;" align="center">
				<td colspan="9" height="25">Laporan Retur Pembelian</td>
            </tr>
			<tr style="background-color:#333; color:#FFFFFF;" align="center">
				<td>No Retur</td>
                <td>Tanggal Retur</td>
                <td>No Faktur</td>
                <td>Nama Suplier</td>
                <td>Nama Barang</td>
				<td>Quantity</td>
                <td>Amount</td>
				<td>Keterangan</td>
				<td>Nama Pembuat</td>
			</tr>
			<?php
				if($dt_barang->num_rows()>0)
				{
					foreach($dt_barang->result_array() as $db)
					{
				?>
				<tr id="<?php echo $db['ReturnNo']; ?>" class="edit_tr">
					<td><?php echo $db['ReturnNo']; ?></td>
					<td><?php echo $db['DateReturn']; ?></td>
                    <td><?php echo $db['NoFaktur']; ?></td>
                    <td><?php echo $db['KodeSupplier']; ?></td>
                    <td><?php echo $db['KodeBarang']; ?></td>
                    <td><?php echo $db['Quantity']; ?></td>
                    <td><?php echo $db['Price']; ?></td>
                    <td><?php echo $db['Keterangan']; ?></td>
                    <td><?php echo $db['CreatedBy']; ?></td>
				</tr>
				<?php
					}
				?>
				<tr valign="top">
            		<td colspan="9" align="center"><input type="submit" class="btn-kirim-login" value="Cetak"><input type="submit" class="btn-kirim-login" value="Back" onclick="javascript:window.location='<?php echo site_url('menuhomecontroller'); ?>';"></td>
               	</tr>
				<?php
				}
				else
				{
					?>
					
				<tr style="text-align:center;">
					<td colspan="9">Belum ada data</td>
				</tr>
					<?php
				}
			?>
		</table>
    	<div class="cleaner_h10"></div>
		<table align="center">
			<tr align="center">
				<td>
					<?php
						//echo $paginator;
					?>
				</td>
			</tr>
		</table>
	</div>
